package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;

/**
struct {
		long	Frame;
		float	x, y, z;
		if (LineType > 1) {
			float	InTanx, InTany, InTanz;
			float	OutTanx, OutTany, OutTanz;
		}
	} scaling[nunks];
 *
 */
public class MDXScalingCOM extends MDXCOM {
	String tag = "KSGC:Scaling";
	public int frame = -1;
	public float x,y,z;
	public float inTan[] = null;
	public float outTan[] = null;
	
	public int parentLineType = -1;
	
	public MDXScalingCOM(String tag,int lineType) {
		parentLineType = lineType;
	}
	
	public String getTag() {
		return tag;
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		frame = ins.readInt();
		x = ins.readFloat();
		y = ins.readFloat();
		z = ins.readFloat();
		if(parentLineType > 1) {
			inTan = new float[3];
			outTan = new float[3];
			for(int i=0;i<inTan.length;i++) inTan[i] = ins.readFloat();
			for(int i=0;i<outTan.length;i++) outTan[i] = ins.readFloat();
		}
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tFRAME : "+frame);
		sb.append("\n\tXYZ : "+x+" : "+y+" : "+z);
		if(parentLineType > 1) {
			sb.append("\n\tINTAN : "+inTan[0]+" : "+inTan[1]+" : "+inTan[2]);
			sb.append("\n\tOUTTAN : "+outTan[0]+" : "+outTan[1]+" : "+outTan[2]);
		}
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return false;
	}
}